#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <map>
#include <set>
#define MAXN 5005
#define MAXM 100005
using namespace std;

int N, M, X[MAXN], min_len_cost[MAXM];
int dp[MAXN];

int main()
{
    freopen("umbrella.txt","r", stdin);
    scanf("%d %d", &N, &M);
    for (int i=0;i<N;i++) scanf("%d", X+i);
    sort(X, X+N);
    for (int i=0;i<M;i++) scanf("%d", min_len_cost + i);
    for (int i=M-2;i>=0;i--)
    {
        min_len_cost[i] = min(min_len_cost[i], min_len_cost[i+1]);
        //cout << min_len_cost[i] << endl;
    }

    memset(dp, 63, sizeof(dp));
    dp[0] = 0;
    for (int n=1;n<=N;n++)
    for (int i=0;i<n;i++)
        dp[n] = min(dp[n], dp[i] + min_len_cost[X[n-1]-X[i]]);
    printf("%d\n", dp[N]);
    return 0;
}
